package admin_advert_api

import (
	"blog_go/models"
	"blog_go/models/res"
	"blog_go/service/common"
	"github.com/gin-gonic/gin"
	"github.com/sirupsen/logrus"
)

// AdvertDel 广告删除
// @Tags 广告管理
// @Summary 广告删除
// @Description 广告删除
// @Param params body models.DeleteRequest true "参数json"
// @Param token header string true "token"
// @Router /api/admin/advert/del [delete]
// @Produce json
// @Success 200 {object} res.Response{data=int}
func (AdminAdvertApi) AdvertDel(c *gin.Context) {
	var delReq models.DeleteRequest
	if err := c.ShouldBindJSON(&delReq); err != nil {
		logrus.Error(err)
		panic(err)
	}
	var advert models.AdvertModel
	count := common.ComDelete(advert, delReq)
	res.OkWithDate(count, c)
}
